package com.gdyx.app.web.svc.impl;


import com.gdyx.app.web.dao.MpsOrgDao;
import com.gdyx.app.web.model.MpsOrg;
import com.gdyx.app.web.svc.MpsOrgSvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Service
public class MpsOrgSvcImpl implements MpsOrgSvc {

    @Autowired
    MpsOrgDao dao;

    @Override
    public void save(MpsOrg o) {
        o.setId(UUID.randomUUID().toString().trim().toUpperCase());
        o.setCreateTime(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
        dao.save(o);
    }

    @Override
    public void delete(String id) {
        dao.delete(id);
    }

    @Override
    public void update(MpsOrg o) {
        o.setModifyTime(new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()));
        dao.update(o);
    }

    @Override
    public int count(Map<String, Object> map) {
        return dao.count(map);
    }

    @Override
    public List<MpsOrg> findMpsOrgs(Map<String, Object> map) {
        return dao.findMpsOrgs(map);
    }

    @Override
    public MpsOrg findMpsOrgById(String id) {
        return dao.findMpsOrgById(id);
    }

}
